#ifndef _BOARD
#define _BOARD

#include "treasure.hpp"
#include "card.hpp"
#include <ctime>
#include <list>

#define SIZE 7
#define MOVING_CARD 34

class Board
{
public:
    Card plate[SIZE][SIZE];
    Card free_card;
    list<Treasure> t;

    Board();

    void init_board();

    void push_east(const unsigned int & lign);
    void push_west(const unsigned int & lign);
    void push_north(const unsigned int & column);
    void push_south(const unsigned int & column);

    bool is_in_same_position(const Treasure & treasure)const;

    static bool can_go_to(const unsigned int & x1,const unsigned int & y1,const unsigned int & x2,const unsigned int & y2);

    friend ostream & operator << (ostream & ost,const Board & b)
    {
        static string symbole_carte[10]= {"╔","╗","╝","╚","╠","╦","╣","╩","║","═"};

        for(unsigned int cpt_c(0) ; cpt_c < SIZE ; ++cpt_c)
        {
            for(unsigned int cpt_l(0) ; cpt_l < SIZE ; ++cpt_l)
                ost << symbole_carte[b.plate[cpt_c][cpt_l].type_card];
            ost << endl;
        }
        ost << "Free card : " << symbole_carte[b.free_card.type_card] << endl;

        for(auto & lec:b.t)
            cout << lec << endl;

        return ost;
    };

private:
    static Card* init_tab_random_free_card();
};

#endif
